package com.zhaojiu.example.service.beetl.function;

import org.beetl.core.Context;
import org.beetl.core.Function;

/**
 * @author huangshb
 * @date 2024/8/5
 */
public class GetMethod implements Function {
    @Override
    public Object call(Object[] paras, Context ctx) {
        Object o = paras[0];
        if (o!=null){
            String methodCode = o.toString();
            String methodName = "POST";
            switch (methodCode) {
                case "1000":
                    methodName = "Post";
                    break;
                case "2000":
                    methodName = "Get";
                    break;
                case "3000":
                    methodName = "Delete";
                    break;
                case "4000":
                    methodName = "Put";
                    break;
                case "5000":
                    methodName = "PATCH";
                    break;
                default:
                    methodName = "Request";
                    break;
            }
            return methodName;
        }
        return "Request";
    }
}
